package com.fwmagic.flink.partition;

import org.apache.flink.api.common.functions.Partitioner;

import java.util.Random;

public class MyCustomPartition implements Partitioner<String> {
    @Override
    public int partition(String key, int numPartitions) {
        if(key.startsWith("flink")){
            return 0;
        }else{
            return new Random().nextInt(5);
        }
    }
}
